package AlgorithmHomework.Chapter04;

import java.util.Scanner;

/**
 * @author 冀玉博
 * @version 1.0
 * 题目：给定一个序列，请你找出逆序对数（满足i<j,但是a[i]>a[j]）
 * 思路：就直接双层循环去找寻就好了
 */
public class P159_4 {
    public static void main(String[] args) {
        System.out.println("请输入序列的个数：");
        Scanner sc = new Scanner(System.in);
        int n =sc.nextInt();
        int a[]= new int[n];
        for(int i =0;i<n;i++) a[i] = sc.nextInt();
        for(int i=0;i<n;i++){
            for(int j =i+1;j<n;j++){
                if(a[i]>a[j]){
                    System.out.print("<" + a[i]+"," + a[j] + ">");
                }
            }
        }
    }
}
